package com.swak.reactivex.context;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.swak.closable.ShutDownHook;

/**
 * 执行最后的清理工作
 * 
 * @author DELL
 */
public class ClosableAnnotationConfigApplicationContext extends AnnotationConfigApplicationContext {

	@Override
	protected void onClose() {
		super.onClose();
		runShutDownHook();
	}

	protected void runShutDownHook() {
		try {
			ShutDownHook.runHook(true).get();
		} catch (Exception e) {
		}
	}
}